package touchtrack.model.artist;

/**
 * Artist
 * 
 * Simple class representing an artist.
 * 
 * @author	MuMe09 team 6
 * 			http://mumetech.wordpress.com/
 */
public class Artist implements ArtistInterface
{
	/**
	 * Constructs an Artist object.
	 * 
	 * @param 	String name
	 * 			The name of the artist, obviously...
	 * @effect	Sets the name.
	 */
	public Artist(String name)
	{
		this.setName(name);
	}
	
	/***************************************************************************
	 * 								Artist name
	 ***************************************************************************/
	
	/**
	 * Returns the artist name.
	 * 
	 * @return	String name
	 */
	public String getName()
	{
		return name.trim();
	}

	/**
	 * Sets the artist name.
	 * 
	 * @param 	String name
	 * @post	this.getName() == name
	 */
	private void setName(String name)
	{
		this.name = name;
	}
	
	/**
	 * Artist name.
	 */
	private String name;
	
	/***************************************************************************
	 * 							Java standard methods
	 ***************************************************************************/
	
	/**
	 * Compares Artists.
	 * 
	 * @param	Object obj
	 * @return	boolean
	 */
	public boolean equals(Object obj)
	{
		if (obj instanceof Artist) {
			Artist a = (Artist)obj;
			return a.getName().equals(this.getName());
		}
		
		return false;
	}
	
	/**
	 * Returns Artist name.
	 */
	public String toString()
	{
		return this.getName();
	}
}